package exam.test13;

import java.util.Objects;

public class Employee extends People {
    private String company;
    private String position;

    public Employee(String name, int age, String company, String position) {
        super(name, age);
        this.company = company;
        this.position = position;
    }

    @Override
    public String toString() {
        String string = "Name: " + getName() + ", age: " + getAge() + "\n";
        string += "Company: " + company + ", position: " + position;
        return string;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return Objects.equals(getName(), employee.getName()) &&
                getAge() == employee.getAge() &&
                Objects.equals(company, employee.company) &&
                Objects.equals(position, employee.position);
    }

}
